#include "my_list.h"
#include <iostream>
#include <thread>

static const int SEUIL = 10;
static my_list<int> liste;

template<typename T>
static void incrementer(T& t) {
	t++;
}

static void thread1() {
	liste.remove_if([](const int n){return n < SEUIL;});
}

static void thread2() {
	liste.for_each(incrementer<int>);
}

int main(int argc, char** argv) {
	liste.push_front(5);
	liste.push_front(2);
	liste.push_front(9);
	liste.push_front(18);
	liste.push_front(9);
	liste.push_front(12);
	liste.push_front(4);
	liste.push_front(14);
	liste.push_front(9);
	liste.push_front(11);
	liste.push_front(8);
	liste.push_front(9);
	thread t2(thread2);
	thread t1(thread1);
	t1.join();
	t2.join();
	node<int>* n = liste.getHead();
	while (n = n->next.get()) {
		cout << *n->data << "  ";
	}
	cout << endl;
	return 0;
}
